<meta charset="utf-8">
<title><%= title %></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<%= canonical_tag(current_store.url_or_custom_domain) %>
<%= csrf_meta_tags %>

<% cache current_store do %>
  <% if current_store.favicon_image.attached? && current_store.favicon_image.variable? %>
    <link rel="icon" href="<%= spree_image_url(current_store.favicon_image, width: 256, height: 256) %>">
  <% end %>
<% end %>

<%= render 'spree/shared/meta_tags' %>
<%= render 'spree/shared/css_variables' %>
<%= render 'spree/shared/fonts' %>

<script async src="https://ga.jspm.io/npm:es-module-shims@1.8.2/dist/es-module-shims.js" data-turbo-track="reload"></script>

<% if Rails.application.importmap.packages["application"].present? %>
  <%= javascript_importmap_tags "application" %>
  <%= javascript_import_module_tag "application-spree-storefront" %>
<% else %>
  <%= javascript_importmap_tags "application-spree-storefront" %>
<% end %>

<%= javascript_tag "wishedVariantIds = #{(current_wishlist&.variant_ids&.map(&:to_s) || []).to_json.html_safe};" %>

<%= stylesheet_link_tag "tailwind", defer: true, data: { turbo_track: 'reload' } %>
<%= stylesheet_link_tag "storefront_page_builder", defer: true, data: { turbo_track: 'reload' } if page_builder_enabled? %>  

<%= yield :head %>

<%= render_storefront_partials(:head_partials) unless page_builder_enabled? %>

<% if Rails.env.test? %>
  <% # for test environment we need to skip uppercase so we won't get false failures with different text transforms %>
  <style>
    .uppercase {
      text-transform: none !important;
    }
  </style>
<% end %>

<%= render 'spree/shared/google_places_api_loader' %>